//
//  MainMessageViewController.m
//  Jyxt
//
//  Created by 刘日 on 17/5/10.
//  Copyright © 2017年 DaLian Rental Housing Management. All rights reserved.
//

#import "MainMessageViewController.h"
#import "MsgViewModel.h"

@interface MainMessageViewController ()

@end

@implementation MainMessageViewController


- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    self.lkNavigationBar.barTintColor = [ExtenColor colors].c_f5f5f5;
//    [self.lkNavigationBar setTitleColor: [ExtenColor colors].c_cccccc];
//    self.lkNavigationBar.clipsToBounds = YES;
    
    UIButton*rightButton = [[UIButton alloc]initWithFrame:CGRectMake(0,0,30,30)];
    [rightButton setTitle:@"查询" forState:UIControlStateNormal];
    [rightButton.titleLabel setFont:[UIFont systemFontOfSize:11]];
    [rightButton addTarget:self action:@selector(searchprogram) forControlEvents:UIControlEventTouchUpInside];
    [rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
    
    self.lkNavigationItem.rightBarButtonItem = rightItem;
    self.platformMsgView.onTap = ^(UIView *view){
        MIX_OPEN(HTML_MESSAGE_PLATFORM);
    };
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleDefault;
}

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    [MsgViewModel getUnreadMsgInfoWhenSuccess:^(NSInteger count, NSString *info) {
        self.infoLabel.text = info;
        self.countLabel.text = [NSString stringWithFormat: @"%ld" , count];
        self.countLabel.hidden = count <= 0;
    } failed:^(NSString *reason) {
        NSLog(@"REASON %@" , reason);
    }];
}
- (IBAction)buttonClick:(id)sender {
    
    [LKFreeCtrl pushViewController:[LKInstance findViewController:@"SearchResidencePermitViewController"]];
    
    
    
}

@end
